/**
 * 
 */
package com.p2p.front.service;

import java.util.List;
import java.util.Map;

import com.p2p.base.model.Money;
import com.p2p.front.dal.model.LoanInfo;
import com.p2p.front.dal.model.LoanVariation;

/**
 * @author ruiqi
 *
 */
public interface LoanVariationService {

	LoanVariation getByLoanId(Long loanId);
	
	void create(LoanVariation loanStatus);
	
	boolean update(LoanVariation loanStatus);
	
	LoanVariation selectByIdForUpdate(Long loanId);
	
	LoanVariation getAndLockById(Long lid,LoanInfo loanInfo);
	
	boolean updateStatusForTenderFull(Long lid,LoanInfo loanInfo);
	
	boolean updateStatusForRepay(Long lid,Money totalInterest);
	
	boolean updateStatusForOver(Long lid);
	
	boolean updateStatusForTimeExpired(Long lid);
	
	LoanInfo getLoanInfoFromCache(Long lid);
	
	void removetLoanInfoFromCache(Long lid);
	
	public Map<Long,LoanVariation> findLoanVariationByIds(List<Long> loanIds);
	
	public boolean checkOverTime(LoanVariation loanVariation);
	
	public List<LoanVariation> findExpiredLoan();
	
	public List<LoanInfo> findCanTenderLoan();
	
	
}
